﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _02_FromBinaryToDecimal
{
    class Program
    {
        static int FromBinaryToDecimalConverter(string binaryNumber)
        {
            int currentPower = 0;
            int decimalNumber = 0;

            while (binaryNumber.Length > currentPower)
            {
                decimalNumber += (((binaryNumber[binaryNumber.Length - currentPower - 1]) - 48)
                    * (int)Math.Pow(2,currentPower));             
                currentPower++;
            }
            return decimalNumber;
        }

        static void Main(string[] args)
        {
            string binaryNumber = Console.ReadLine();
            Console.WriteLine(FromBinaryToDecimalConverter(binaryNumber));

        }
    }
}
